<template>
	<wsPage :title="订单列表">
		<div slot="page_operate">
			<Button  @click="refresh"><Icon type="refresh"></Icon><span>刷新</span></Button>
		</div>
		<Row class="ws-row-tab">
			<Col span="24">
			<Button :class="{'ws-btn-active': stat.active == 0}"  @click="queryStatus(0)">全部订单(<span class="ws-text-red" v-text="stat.num0"></span>)</Button>
			<Button :class="{'ws-btn-active': stat.active == 1}" @click="queryStatus(1)">待付款(<span class="ws-text-red" v-text="stat.num1"></span>)</Button>
			<Button :class="{'ws-btn-active': stat.active == 2}" @click="queryStatus(2)">待接单(<span class="ws-text-red" v-text="stat.num2"></span>)</Button>
			<Button :class="{'ws-btn-active': stat.active == 3}" @click="queryStatus(3)">待发货(<span class="ws-text-red" v-text="stat.num3"></span>)</Button>
			<Button :class="{'ws-btn-active': stat.active == 4}" @click="queryStatus(4)">已发货(<span class="ws-text-red" v-text="stat.num4"></span>)</Button>
			<Button :class="{'ws-btn-active': stat.active == 5}" @click="queryStatus(5)">待评价(<span class="ws-text-red" v-text="stat.num5"></span>)</Button>
			<Button :class="{'ws-btn-active': stat.active == 6}" @click="queryStatus(6)">交易成功(<span class="ws-text-red" v-text="stat.num6"></span>)</Button>
			<Button :class="{'ws-btn-active': stat.active == 7}" @click="queryStatus(7)">交易关闭(<span class="ws-text-red" v-text="stat.num7"></span>)</Button>
			</Col>
		</Row>
		<!-- 全部订单列表 -->
		<wsSmPanel :page="table.page" @simple-query="query" @page-change="query">
			<div slot="query_form">
				<Form :model="queryForm" :label-width="100" inline>
					<FormItem label="订单编号">
						<Input v-model="queryParam.model.sn" :placeholder="请输入"></Input>
					</FormItem>
					<FormItem label="商品名称">
						<Input v-model="queryParam.model.goodsName" :placeholder="请输入"></Input>
					</FormItem>
					<FormItem label="收货人">
						<Input v-model="queryParam.model.consignee" :placeholder="请输入"></Input>
					</FormItem>
					<FormItem label="收货人电话">
						<Input v-model="queryParam.model.consigneePhone" :placeholder="请输入"></Input>
					</FormItem>
					<FormItem label="买家留言">
                            <Select clearable v-model="queryParam.model.memo" placeholder="请选择" class="ws-form-select">
                                <Option value="1">无</Option>
                                <Option value="2">有</Option>
                            </Select>
                        </FormItem>
				</Form>
			</div>
			<div slot="list_data">
				<ws-table :data="table.datas" style="width: 100%">
					<ws-table-column align="center" type="selection"  fixed="left"></ws-table-column>
					<ws-table-column align="center" prop="order.sn" label="订单编号" fixed="left"></ws-table-column>
					<ws-table-column align="center" label="商品信息" min-width="300">
						<template slot-scope="scope">
							<table style="width:100%">
								<tr v-for="item in scope.row.items">
									<td style="width: 80px">
										<img :src="item.thumbnail" style="width:80px;height:80px;margin: 0 5px;"/>
									</td>
									<td style="width:100%">
										<span v-text="item.localName"></span>
									</td>
								</tr>
							</table>
						</template>
					</ws-table-column>
					<ws-table-column align="center" prop="order.shop" label="店铺名"  fixed="left"></ws-table-column>
					<ws-table-column align="center" label="会员信息" >
						<template slot-scope="scope">
							<p><span v-text="scope.row.order.nickname"></span></p>
							<p><span v-text="scope.row.order.memberPhone"></span></p>
						</template>
					</ws-table-column>
					<ws-table-column align="center" prop="order.consumeAmount" label="订单金额" ></ws-table-column>
					<ws-table-column align="center" label="支付信息" >
						<template slot-scope="scope">
							<p><span v-text="scope.row.order.payAmount"></span></p>
						</template>	
					</ws-table-column>
					<ws-table-column align="center" label="收件人信息" >
						<template slot-scope="scope">
							<p><span v-text="scope.row.order.consignee"></span></p>
							<p><span v-text="scope.row.order.consigneePhone"></span></p>
							<p><span v-text="scope.row.order.consigneeAddress"></span></p>
						</template>
					</ws-table-column>
					<ws-table-column align="center" prop="order.createDate" label="创建时间" ></ws-table-column>
					<ws-table-column align="center" prop="order.memo" label="订单备注" ></ws-table-column>
					<ws-table-column align="center" label="订单状态"  fixed="right" v-if="stat.active == 0">
						<template slot-scope="scope">
							<Tag v-if="scope.row.order.status == 1">待付款</Tag>
							<Tag v-if="scope.row.order.status == 2">待接单</Tag>
							<Tag v-if="scope.row.order.status == 3">待发货</Tag>
							<Tag v-if="scope.row.order.status == 4">已发货</Tag>
							<Tag v-if="scope.row.order.status == 5 && scope.row.order.tradeStatus == 1">待评价</Tag>
							<Tag v-if="scope.row.order.status == 5 && scope.row.order.tradeStatus == 2">交易成功</Tag>
							<Tag v-if="scope.row.order.status == 6">交易关闭</Tag>
						</template>
					</ws-table-column>
					<ws-table-column align="center" label="关单原因"  fixed="right" v-if="stat.active == 7">
						<template slot-scope="scope">
							<span v-if="scope.row.order.tradeStatus == 1">用户取消付款</span>
							<span v-if="scope.row.order.tradeStatus == 2">付款超时系统取消</span>
							<span v-if="scope.row.order.tradeStatus == 3">用户支付后取消订单</span>
							<span v-if="scope.row.order.tradeStatus == 4">用户支付商家超时系统取消订单</span>
							<span v-if="scope.row.order.tradeStatus == 5">商家未接单</span>
							<span v-if="scope.row.order.tradeStatus == 6">商家已经发货,用户申请退款退货</span>
						</template>
					</ws-table-column>
					<ws-table-column align="center" label="操作"  fixed="right">
						<template slot-scope="scope">
							<Button @click="jumpDetail(scope.row.order.id, null)" type="text" size="small">操作历史</Button>
							<Button @click="jumpDetail(scope.row.order.id, null)" type="text" size="small">订单详情</Button>
							<!-- <Button @click="showMemoModal(scope.row)" type="text" size="small">添加备注</Button>
							<Button @click="revisePrice(scope.row)" type="text" size="small" v-if="stat.active == 1">修改价格</Button>
							<Button @click="takingOrder(scope.row)" type="text" size="small" v-if="stat.active == 2">接单</Button>
							<Button @click="deliveryGoods(scope.row)" type="text" size="small" v-if="stat.active == 3">发货</Button> -->
							<Button @click="logisticsDetail(scope.row)" type="text" size="small" v-if="stat.active == 4">查看物流</Button>
						</template>
					</ws-table-column>
				</ws-table>
			</div>
		</wsSmPanel>
		
		<!--接单-->
		<!-- <wsModal v-model="modal1.show"  :ok-text="保存" :cancelText="取消"  :title="订单接单确认" @on-ok="modal1Ok" @on-cancel="modal1Cancel">
			<Alert>取消接单会触发退款流程并且会影响商户的信誉度和商户品质分,请慎重操作！！！</Alert>
			<Form ref="modal1from" :model="modal1.model" :rules="modal1.validate" :label-width="100">
				<FormItem :label="是否接单" prop="status" required>
					<RadioGroup v-model="modal1.model.action">
						<Radio :label="1">是</Radio>
						<Radio :label="2">否</Radio>
					</RadioGroup>
				</FormItem>
				<FormItem :label="处理意见" prop="memo">
					<Input v-model="modal1.model.memo" :placeholder="请输入" type="textarea"></Input>
				</FormItem>
			</Form>		
		</wsModal> -->
		
		<!--发货-->
		<!-- <wsModal v-model="modal2.show"  :ok-text="保存"  :cancelText="取消"  :title="订单发货" @on-ok="modal2Ok" @on-cancel="modal2Cancel">
			<Form ref="modal2from" :model="modal2.model" :rules="modal2.rules" :label-width="100">
				<FormItem :label="发货方式" prop="status" required>
					<RadioGroup v-model="modal2.model.type">
						<Radio :label="1" disabled>直邮</Radio>
						<Radio :label="2">中转仓库</Radio>
					</RadioGroup>
				</FormItem>
				<FormItem :label="中转仓库" prop="expressAddressId" >
					<Select v-model="modal2.model.expressAddressId" filterable @on-change="expressAddressChange">
		                <Option v-for="item in modal2.fields.transfers" :value="item.wKey" :key="item.wKey">{{ item.wValue }}</Option>
		            </Select>
				</FormItem>
				<FormItem :label="送货方式" prop="status" required>
					<RadioGroup v-model="modal2.model.action" @on-change="modal2ActionChange">
						<Radio :label="1">快递</Radio>
						<Radio :label="2">自己送达</Radio>
					</RadioGroup>
				</FormItem>
				<FormItem :label="快递公司" prop="expressId">
					<Select v-model="modal2.model.expressId" filterable :disabled="modal2.model.action == 2">
		                <Option v-for="item in modal2.fields.expresses" :value="item.value" :key="item.value">{{ item.label }}</Option>
		            </Select>
				</FormItem>
				<FormItem :label="快递单号" prop="trackingNo">
					<Input v-model="modal2.model.trackingNo" :placeholder="请输入" :disabled="modal2.model.action == 2"></Input>
				</FormItem>
				<FormItem :label="收件人" required>
					<span v-text="modal2.model.consignee"></span>
				</FormItem>
				<FormItem :label="联系方式" required>
					<span v-text="modal2.model.phone"></span>
				</FormItem>
				<FormItem :label="邮寄地址" required>
					<span v-text="modal2.model.address"></span>
				</FormItem>
				<FormItem :label="处理意见" prop="memo">
					<Input v-model="modal2.model.memo" :placeholder="请输入" type="textarea"></Input>
				</FormItem>
			</Form>		
		</wsModal>	 -->
		
		<!--修改订单价格-->
		<!-- <wsModal v-model="modal3.show"  :ok-text="保存"  :cancelText="取消"  :title="修改订单价格" @on-ok="modal3Ok" @on-cancel="modal3Cancel">
			<Form ref="modal3from" :model="modal3.model" :rules="modal3.validate" :label-width="100">
				<FormItem :label="总金额" required>
					<span v-text="modal3.model.totalAmount"></span>
				</FormItem>
				<FormItem :label="消费金额" required>
					<span v-text="modal3.model.consumeAmount"></span>
				</FormItem>
				<FormItem :label="支付金额" prop="status" required>
					<InputNumber :min="0" @on-blur="payAmountFormatter()" v-model="modal3.model.payAmount"></InputNumber>
				</FormItem>
				<FormItem :label="处理意见" prop="memo">
					<Input v-model="modal3.model.memo" :placeholder="请输入" type="textarea"></Input>
				</FormItem>
			</Form>		
		</wsModal>	 -->
		
		<!--查看订单物流-->
		<!--物流跟踪弹框-->
		<wsModal v-model="logisticModal.show" :title="物流信息" :whetherShowCancel="false" :whetherShowOk="false" 
		 @on-ok="logisticModalOk" @on-cancel="logisticModalCancel">
            <Row style="padding-bottom: 10px;">
				<Col span="24" class="layout-content-main" style= "font-size: 15px;">
					<Col span="12" >
						<Col span="8">
							快递公司:
						</Col>
						<Col>
							{{logisticModal.form.ShipperCode}}
						</Col> 
					</Col>
					<Col span="12">
						<Col span="6">
							快递单号:
						</Col>
						<Col>
							{{logisticModal.form.LogisticCode}}
						</Col>	 
					</Col>
				</Col>
			</Row>
			<Row>
				<Col span="24" class="layout-content-main" style= "font-size: 15px;">
					<Steps  :current="logisticModal.form.count" :status="logisticModal.form.State" direction="vertical">
				        <Step v-for="Traces in logisticModal.form.Traces" :title="Traces.AcceptStation" :content="Traces.AcceptTime"></Step>
					</Steps>
				</Col>
			</Row>
		</wsModal>	
		
		<!--添加订单备注-->
		<!-- <wsModal v-model="modal5.show"  :ok-text="保存" :cancelText="取消"  :title="添加备注信息" @on-ok="modal5Ok" @on-cancel="modal5Cancel">
			<Form ref="modal5from" :model="modal5.model" :rules="modal5.rules" :label-width="100">
				<FormItem :label="订单备注" prop="memo">
					<Input v-model="modal5.model.memo" :placeholder="请输入" type="textarea" :rows="5"></Input>
				</FormItem>
			</Form>		
		</wsModal>		 -->
		
	</wsPage>
</template>

<script>
	export default {
		data() {
			return {
				stat: {
					active: 0,
					num0: 0,
					num1: 0,
					num2: 0,
					num3: 0,
					num4: 0,
					num5: 0,
					num6: 0,
					num7: 0,
				},
				queryParam: {
					model: {
						status: 0, //查询状态
						sn: '',
						consignee: '',
						consigneePhone: '',
						memo: ''
					}
				},
				//查询物流跟踪
				findLogistic: {
					orderId: ''
				},
				table: {
					datas: [],
					page: {
						total: 0, //总条数
						pageNum: 1, //当前页
						pageSize: 10 //每页显示条数
					},
					editRow: null
				},
				modal1: { //接单
					show: false,
					model: {
						action: 1, //确认接单
						memo: '' //接单备注
					}
				},
				modal2: { //发货
					show:false,
					fields: {
						transfers: [], //中转仓列表
						expresses: [], //快递公司
						transferMap: {} //中转仓详情
					},
					rules: {
						expressAddressId: [{required: true, message: '请选择中转仓'}],
						expressId: [{required: true, message: '请选择物流'}],
						trackingNo: [{required: true, message: '请输入运单号'}]
					},
					model: {
						action:1, //1.快递 2.自己送达
						type: 2, //1.直邮 2.中转仓
						expressAddressId: '', 
						trackingNo: '',
						memo: '',
						expressId: '',
						consignee: '',
						phone: '',
						address: ''
					}
				},
				modal3: { //修改订单价格
					show:false,
					model: {
						totalAmount: 0,
						consumeAmount: 0,
						payAmount: 0,
						memo: ''
					}
				},
				//物流跟踪
				logisticModal: {
					show: false,
					form: {
						ShipperCode:'',
						LogisticCode: '',
						Traces: [],
						count: 0 ,
						State: null
					}
				},
				modal5: { //订单备注
					show: false,
					rules: {
						memo: [{required: true, message: '请输入备注信息'}]
					},
					model: {
						memo: ''
					}
				}
			}
		},
		mounted() {
			this.init();
			// let getCurrentLanguage=localStorage.getItem('currentLanguage');
			// this.$i18n.locale=getCurrentLanguage;
			// if(this.$i18n.locale=='en'){
			// 	this.modal2.rules={
			// 		expressAddressId: [{required: true, message: 'Please select a transfer warehouse'}],
			// 		expressId: [{required: true, message: 'Please choose logistics'}],
			// 		trackingNo: [{required: true, message: 'Please enter the waybill number'}]
			// 	};
			// 	this.modal5.rules={
			// 		memo: [{required: true, message: 'Please enter a comment'}]
			// 	}
			// }else if(this.$i18n.locale=='it'){
			// 	this.modal2.rules={
			// 		expressAddressId: [{required: true, message: 'Si prega di selezionare un magazzino di trasferimento'}],
			// 		expressId: [{required: true, message: 'Si prega di scegliere la logistica'}],
			// 		trackingNo: [{required: true, message: 'Si prega di inserire il numero della lettera di vettura'}]
			// 	};
			// 	this.modal5.rules={
			// 		memo: [{required: true, message: 'Si prega di inserire un commento'}]
			// 	}
			// }
		},
		methods: {
			init() {
				this.initData();
				this.initFields();
			},
			initData() {
				this.query();	
				this.initStat();
			},
			/**
			 * 初始化属性
			 */
			initFields() {
				this.initExpress();
				this.initTransfers();
			},
			/**
			 * 初始化物流信息
			 */
			initExpress() {
				const _this = this;
				this.axios.get('/ws/ops/expresss/findvalue').then(response => {
					var res = response.data;
					var resMeta = res.meta;
					if(0 == resMeta.code) {
						_this.modal2.fields.expresses = res.data;
					} else {
						_this.$Message.warning(resMeta.message);
					}
				});
			},
			/**
			 * 初始化中转仓列表
			 */
			initTransfers() {
				const _this = this;
				this.axios.get('/ws/ops/v2/transferstorehouses').then(response => {
					var res = response.data;
					var resMeta = res.meta;
					if(0 == resMeta.code) {
						_this.modal2.fields.transfers = res.data;
					} else {
						_this.$Message.warning(resMeta.message);
					}
				});
			},			
			query() {
				let pageSize = this.table.page.pageSize;
				let pageNum = this.table.page.pageNum;
				const _this = this;
				this.axios
					.get("/ws/v2/ms/orders/" + pageSize + "/" + pageNum, {
						params: _this.queryParam.model
					})
					.then(response => {
						var res = response.data;
						var resMeta = res.meta;
						if(0 == resMeta.code) {
							_this.buildPageData(res.data);
						} else {
							_this.$Message.warning(resMeta.message);
						}
					});
			},
			buildPageData(data) {
				this.table.page.total = data.size;
				// console.log(data.list);
				data.list.forEach(function(v,index){
					v.order.consumeAmount = v.order.consumeAmount * 8;
					// console.log(v.consumeAmount);
				});
				// console.log(data.list)
				this.table.datas = data.list;
			},
			/**
			 * 统计信息
			 */
			initStat() {
				const _this = this;
				this.axios
					.get("/ws/v2/ms/orders/stat")
					.then(response => {
						var res = response.data;
						var resMeta = res.meta;
						if(0 == resMeta.code) {
							_this.buildStatData(res.data);
						} else {
							_this.$Message.warning(resMeta.message);
						}
					});
			},
			buildStatData(data) {
				this.stat.num0 = data.stat0;
				this.stat.num1 = data.stat1;
				this.stat.num2 = data.stat2;
				this.stat.num3 = data.stat3;
				this.stat.num4 = data.stat4;
				this.stat.num5 = data.stat5;
				this.stat.num6 = data.stat6;
				this.stat.num7 = data.stat7;
			},
			queryStatus(status_) {
				this.stat.active = status_;
				this.queryParam.model.status = status_;
				this.query();	
			},
            refresh(){
				this.table.page.total = 0;
				this.table.page.pageSize = 10;
				this.table.page.pageNum = 1;
				this.query();
				this.initStat();
            },
			/**
			 * 接单
			 */
			// takingOrder(row) {
			// 	this.table.editRow = row;
			// 	this.modal1.show = true;
			// },
			// /**
			//  * 接单确认
			//  */
			// modal1Ok() {
			// 	this.$refs['modal1from'].validate((valid) => {
			// 		if(valid) {
			// 			this.modal1Submit();
			// 		}
			// 	});
			// },
			// /**
			//  * 接单确认
			//  */
			// modal1Submit() {
			// 	const _this = this;
			// 	let curr_order = this.table.editRow;
			// 	let postData = {
			// 		orderId: curr_order.order.id,
			// 		action: this.modal1.model.action,
			// 		memo: this.modal1.model.memo
			// 	};
			// 	this.axios
			// 		.put("/ws/v2/ms/orders/receipt", postData)
			// 		.then(response => {
			// 			var res = response.data;
			// 			var resMeta = res.meta;
			// 			if(0 == resMeta.code) {
			// 				if(_this.$i18n.locale=='zh'){
			// 					_this.$Message.success('接单操作成功');
			// 				}else if(_this.$i18n.locale=='en'){
			// 					_this.$Message.success('Successful operation');
			// 				}else if(_this.$i18n.locale=='it'){
			// 					_this.$Message.success('Operazione riuscita');
			// 				}
							
			// 				_this.modal1Cancel();
			// 				_this.initData();
			// 			} else {
			// 				_this.$Message.warning(resMeta.message);
			// 			}
			// 		});
			// },
			// /**
			//  * 接单取消
			//  */
			// modal1Cancel() {
			// 	this.modal1.model.action = 1;
			// 	this.modal1.model.memo = '';
			// 	this.$refs['modal1from'].resetFields();
			// 	this.modal1.show = false;
			// },
			// /**
			//  * 发货
			//  */
			// deliveryGoods(row) {
			// 	this.table.editRow = row;
			// 	this.modal2.show = true;
			// },
			// /**
			//  * 确认订单发货
			//  */
			// modal2Ok() {
			// 	this.$refs['modal2from'].validate((valid) => {
			// 		if(valid) {
			// 			this.modal2Submit();
			// 		}
			// 	});
			// },
			// /**
			//  * 确认发货
			//  */
			// modal2Submit() {
			// 	const _this = this;
			// 	let curr_order = this.table.editRow;
			// 	let postData = {
			// 		orderId: curr_order.order.id,
			// 		expressId: this.modal2.model.action == 2 ? -1 : this.modal2.model.expressId,
			// 		trackingNo: this.modal2.model.trackingNo,
			// 		expressAddressId: this.modal2.model.expressAddressId,
			// 		type: this.modal2.model.type,
			// 		memo: this.modal2.model.memo
			// 	};
			// 	this.axios
			// 		.post("/ws/v2/ms/orders/delivery", postData)
			// 		.then(response => {
			// 			var res = response.data;
			// 			var resMeta = res.meta;
			// 			if(0 == resMeta.code) {
			// 				if(_this.$i18n.locale=='zh'){
			// 					_this.$Message.success('发货成功');
			// 				}else if(_this.$i18n.locale=='en'){
			// 					_this.$Message.success('Successful delivery');
			// 				}else if(_this.$i18n.locale=='it'){
			// 					_this.$Message.success('Consegna di successo');
			// 				}
							
			// 				_this.modal2Cancel();
			// 				_this.initData();
			// 			} else {
			// 				_this.$Message.warning(resMeta.message);
			// 			}
			// 		});
			//},
			/**
			 * 取消订单发货
			 */
			// modal2Cancel() {
			// 	this.modal2.show = false;
			// 	this.modal2.model.action = 1; //1.快递 2.自己送达
			// 	this.modal2.model.type = 2; //1.直邮 2.中转仓
			// 	this.modal2.model.expressAddressId = ''; 
			// 	this.modal2.model.trackingNo = '';
			// 	this.modal2.model.memo = '';
			// 	this.modal2.model.expressId = '';
			// 	this.modal2.model.consignee = '';
			// 	this.modal2.model.phone = '';
			// 	this.modal2.model.address = '';
			// 	this.$refs['modal2from'].resetFields();
			// },
			// /**
			//  * 修改订单价格
			//  */
			// revisePrice(row) {
			// 	this.table.editRow = row;
			// 	this.modal3.model.totalAmount = row.order.totalAmount;
			// 	this.modal3.model.consumeAmount = row.order.consumeAmount;
			// 	this.modal3.model.payAmount = row.order.payAmount;
			// 	this.modal3.show = true;
			// },
			/**
			 * 查看物流
			 */
			logisticsDetail(row) {
				this.table.editRow = row;
				this.queryLogistic(row.order.id);
			},
			/**
			 * 修改订单价格
			 */
			// modal3Ok() {
			// 	const _this = this;
			// 	let curr_order = this.table.editRow;
			// 	let postData = {
			// 		id: curr_order.order.id,
			// 		payAmount: this.modal3.model.payAmount,
			// 		memo: this.modal3.model.memo
			// 	};
			// 	this.axios
			// 		.put("/ws/v2/ms/orders/taking", postData)
			// 		.then(response => {
			// 			var res = response.data;
			// 			var resMeta = res.meta;
			// 			if(0 == resMeta.code) {
			// 				if(_this.$i18n.locale=='zh'){
			// 					_this.$Message.success('修改订单价格成功');
			// 				}else if(_this.$i18n.locale=='en'){
			// 					_this.$Message.success('Modify order price successfully');
			// 				}else if(_this.$i18n.locale=='it'){
			// 					_this.$Message.success("Modifica il prezzo dell'ordine con successo");
			// 				}
							
			// 				_this.modal3Cancel();
			// 				_this.query();
			// 			} else {
			// 				_this.$Message.warning(resMeta.message);
			// 			}
			// 		});
			// },
			/**
			 * 取消修改订单价格
			 */
// 			modal3Cancel() {
// 				this.modal3.model.payAmount = 0;
// 				this.modal3.model.memo = '';
// 				this.modal3.show = false;
// 			},
// 			/**
// 			 * 添加备注
// 			 */
// 			modal4Ok() {
				
// 			},
// 			/**
// 			 * 取消添加备注
// 			 */
// 			modal4Cancel() {
// 				this.modal4.show = false;
// 			},
// 			/**
// 			 * 中转仓发生变化
// 			 */
// 			expressAddressChange(val) {
// 				if(!val) {
// 					return;
// 				}
// 				let transferInfo = this.modal2.fields.transferMap[val];
// 				if(!transferInfo) {
// 					this.initTransferInfo(val, this.initTransferData);
// 				} else {
// 					this.initTransferData(transferInfo);
// 				}
// 			},
// 			/**
// 			 * 设置中转仓数据
// 			 */
// 			initTransferData(data) {
// 				this.modal2.fields.transferMap[data.id] = data;
// 				this.modal2.model.consignee = data.consignee;
// 				this.modal2.model.phone = data.consigneePhone;
// 				this.modal2.model.address = data.address;
// 			},
// 			/**
// 			 * 初始化中转仓信息
// 			 */
// 			initTransferInfo(transferId, callback) {
// 				const _this = this;
// 				this.axios.get('/ws/ops/v2/transferstorehouses/' + transferId).then(response => {
// 					var res = response.data;
// 					var resMeta = res.meta;
// 					if(0 == resMeta.code) {
// 						callback(res.data);
// 					} else {
// 						_this.$Message.warning(resMeta.message);
// 					}
// 				});
// 			},
// 			/**
// 			 * 发货方式切换
// 			 */
// 			modal2ActionChange(val) {
// //				this.$refs['modal2from'].resetFields();
// 				if(1 == val) {
// 					if(this.$i18n.locale=='zh'){
// 						this.modal2.rules['expressId'] = [{required: true, message: '请选择物流'}];
// 						this.modal2.rules['trackingNo'] = [{required: true, message: '请输入运单号'}];
// 					}else if(this.$i18n.locale=='en'){
// 						this.modal2.rules['expressId'] = [{required: true, message: 'Please choose logistics'}];
// 						this.modal2.rules['trackingNo'] = [{required: true, message: 'Please enter the waybill number'}];
// 					}else if(this.$i18n.locale=='it'){
// 						this.modal2.rules['expressId'] = [{required: true, message: 'Si prega di scegliere la logistica'}];
// 						this.modal2.rules['trackingNo'] = [{required: true, message: 'Si prega di inserire il numero della lettera di vettura'}];
// 					}
					
// 				} else {
// 					this.modal2.rules['expressId'] = [];
// 					this.modal2.rules['trackingNo'] = [];
// 				}
// 			},
// 			/**
// 			 * 支付金额格式化
// 			 */
// 			payAmountFormatter() {
// 				this.modal3.model.payAmount = parseFloat(parseFloat(this.modal3.model.payAmount).toFixed(2));
// 			},
			/**
			 * 订单备注
			 */
			// modal5Ok() {
			// 	this.$refs['modal5from'].validate((valid) => {
			// 		if(valid) {
			// 			this.modal5Submit();
			// 		}
			// 	});
			// },
			// /**
			//  * 订单备注提交
			//  */
			// modal5Submit() {
			// 	const _this = this;
			// 	let curr_order = this.table.editRow;
			// 	let postData = {
			// 		id: curr_order.order.id,
			// 		memo: this.modal5.model.memo
			// 	};
			// 	this.axios
			// 		.put("/ws/v2/ms/orders/memo", postData)
			// 		.then(response => {
			// 			var res = response.data;
			// 			var resMeta = res.meta;
			// 			if(0 == resMeta.code) {
			// 				if(_this.$i18n.locale=='zh'){
			// 					_this.$Message.success('添加订单备注成功');
			// 				}else if(_this.$i18n.locale=='en'){
			// 					_this.$Message.success('Add order note successfully');
			// 				}else if(_this.$i18n.locale=='it'){
			// 					_this.$Message.success("Aggiungi la nota dell'ordine correttamente");
			// 				}
							
			// 				_this.modal5Cancel();
			// 				_this.query();
			// 			} else {
			// 				_this.$Message.warning(resMeta.message);
			// 			}
			// 		});
			// },
			// /**
			//  * 订单备注取消
			//  */
			// modal5Cancel() {
			// 	this.$refs['modal5from'].resetFields();
			// 	this.modal5.model.memo = '';
			// 	this.modal5.show = false;
			// },
			/**
			 * 显示订单备注的页面
			 */
			// showMemoModal(row_) {
			// 	this.table.editRow = row_;
			// 	this.modal5.show = true;
			// },
			/**
			 * 查询物流跟踪
			 */
			queryLogistic(id){
				const _this = this;
				_this.findLogistic.orderId = id;
    			this.axios.post('/ws/ms/orderShippings/condition' , _this.findLogistic).then(response => {
					var res = response.data;
					var resMeta = res.meta;

					if (0 == resMeta.code) {
						if(res.data == null){
							_this.logisticModal.form.ShipperCode = res.data.ShipperCode;
							_this.logisticModal.form.LogisticCode = res.data.LogisticCode;
							_this.logisticModal.show = true;
							return;
						}
						_this.logisticModal.form = res.data;
						if(res.data.Traces == null){
							_this.$Message.warning('查询物流失败');
							return;
						}
						_this.logisticModal.form.Traces = _this.logisticModal.form.Traces.reverse();
						_this.logisticModal.form.ShipperCode = res.data.ExpressCompany;
						_this.logisticModal.form.LogisticCode = res.data.LogisticCode;
						_this.logisticModal.form.State = res.data.State;
						_this.logisticModal.form.count = _this.logisticModal.form.Traces.length - 1;
						_this.changeLogisticStatus( _this.logisticModal.form.State);
						_this.logisticModal.show = true;
					} else {
						_this.$Message.warning(resMeta.message);
					}
				});
			},
			changeLogisticStatus(State){
				if(State == '0' || State == '1' || State == '5'){
					this.logisticModal.form.State = 'process';
				}
				if(State == '3'){
					this.logisticModal.form.State = 'finish';
				}
				if(State == '4' || State == '2' || State == '6'){
					this.logisticModal.form.State = 'error';
				}
			},
			logisticModalOk(){

			},
			logisticModalCancel(){
				this.logisticModal.show = false;
				this.logisticModal.form.ShipperCode = '';
				this.logisticModal.form.LogisticCode = '';
				this.logisticModal.form.traces = [];
				this.logisticModal.form.count = 0;
			},
			/**
			 * 查看详情
			 */
			jumpDetail(id,refundId){
				// this.$router.push('/orderDetail?id='+id);
				// this.$router.push({name:'/orderDetail?id='+id});
				if('' == refundId || null == refundId){
					refundId = "-1";
				}
				window.open('/orderDetail?id='+id+'&refundId='+refundId);
				// this.$router.push({name:'ms_orderDetail_detail',query:{id:id,refundId:refundId}});
			},
		}
	}
</script>

<style>

</style>